package dao;

import lmp.BooktableMapper;
import model.Booktable;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Map;

/**
 * Created by jason on 15/12/9.
 */
public class bookDao {

    private static SqlSessionFactory sqlSessionFactory;
    private static Reader reader;

    public List<Map<String,Object>> selectAll() throws IOException {
        reader = Resources.getResourceAsReader("mybatis-config.xml");
        sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
        SqlSession session = sqlSessionFactory.openSession();
        Booktable book= session.getMapper(BooktableMapper.class).selectByPrimaryKey(1);
        return null;
    }
}
